﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Business;

namespace KhoBanHang
{
    public partial class Home : Form
    {
        public Home()
        {
            InitializeComponent();
        }

        private void Home_Load(object sender, EventArgs e)
        {
            int quyentmp = Int16.Parse(@Session.quyen);

            if (quyentmp == 0)
            {                
                //menuStrip1.Items["QuanLiKhotoolStripMenuItem"].Visible = false;
                
            }
            else if (quyentmp == 1)
            {
                label1.Visible = false;
                label2.Visible = false;
                HomeTPKD uc = new HomeTPKD();
                uc.TopLevel = false;
                uc.Location = new Point(0, 0);
                uc.FormBorderStyle = FormBorderStyle.None;
                uc.Visible = true;
                panel1.Controls.Add(uc);
                menuStrip1.Items["QuanLiKhotoolStripMenuItem"].Visible = false;
            }
            else if (quyentmp == 2)
            {
                label1.Visible = false;
                label2.Visible = false;             
                HomeNVKD uc = new HomeNVKD();                
                panel1.Controls.Add(uc);

                menuStrip1.Items["MuaHangtoolStripMenuItem"].Visible = false;
                menuStrip1.Items["QuanLiKhotoolStripMenuItem"].Visible = false;

                DanhMucToolStripMenuItem.DropDownItems["KhachHangToolStripMenuItem"].Visible = false;
                DanhMucToolStripMenuItem.DropDownItems["NhanVienToolStripMenuItem"].Visible = false;
                
                BanHangtoolStripMenuItem.DropDownItems["ThuTienKHToolStripMenuItem"].Visible = false;
                BanHangtoolStripMenuItem.DropDownItems["TongHopBHToolStripMenuItem"].Visible = false;
                BanHangtoolStripMenuItem.DropDownItems["TheoDOiCOngNoKHToolStripMenuItem1"].Visible = false;
                
                
            }
            else if (quyentmp == 3)
            {
                //thu kho
                label1.Visible = false;
                label2.Visible = false;
                HomeKho uc = new HomeKho();
                panel1.Controls.Add(uc);
                menuStrip1.Items["MuaHangtoolStripMenuItem"].Visible = false;
                menuStrip1.Items["BanHangtoolStripMenuItem"].Visible = false;
                
                DanhMucToolStripMenuItem.DropDownItems["KhachHangToolStripMenuItem"].Visible = false;
                DanhMucToolStripMenuItem.DropDownItems["NhanVienToolStripMenuItem"].Visible = false;

            }
            
        }
                

        private void KhachHangToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DanhMucKhachHang uc = new DanhMucKhachHang();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }
        

        private void NhanVienToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DMNhanVien uc = new DMNhanVien();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void HangHoaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DMHang uc = new DMHang();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }
  
        private void LoaiHangToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DanhMucLoaiHang uc = new DanhMucLoaiHang();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);

        }


        #region Xoa form cu
        private void DanhMucToolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            panel1.Controls.Clear();
        }

        private void MuaHangtoolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            panel1.Controls.Clear();
        }

        private void BanHangtoolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            panel1.Controls.Clear();
        }

        private void QuanLiKhotoolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            panel1.Controls.Clear();
        }

        private void BaoCaoToolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            panel1.Controls.Clear();
        }

        private void HeThongToolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            panel1.Controls.Clear();
        }
        private void XuatKhoToolStripMenuItem1_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            panel1.Controls.Clear();
        }
        private void NhapKhoToolStripMenuItem1_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            panel1.Controls.Clear();
        }

        #endregion

        private void DatHangNCCToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DonDatNCC uc = new DonDatNCC();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void HoaDonNhapToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HoaDonMuaHang uc = new HoaDonMuaHang();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void KhachHangDatToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            DonDatKH uc = new DonDatKH();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }
           

        private void HDonPhieuXuatToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HoaDonBanHang uc = new HoaDonBanHang();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }
               

        private void PhieuGiaoHangToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            PhieuGiaoHang_DanhSach uc = new PhieuGiaoHang_DanhSach();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void tổngHợpMuaHàngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TongHopMuaHang uc = new TongHopMuaHang();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void ThuTienKHToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ThuTienKH uc = new ThuTienKH();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void TongHopBHToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TongHopBanHang uc = new TongHopBanHang();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void DSHDMenuItem_Click(object sender, EventArgs e)
        {
            HoaDonBanHang uc = new HoaDonBanHang();
            
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void DSPXKMenuItem_Click(object sender, EventArgs e)
        {
            PhieuXKho_DanhSach uc = new PhieuXKho_DanhSach();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void DSPhieuGHMenuItem_Click(object sender, EventArgs e)
        {
            PhieuGiaoHang_DanhSach uc = new PhieuGiaoHang_DanhSach();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void đăngXuấtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
            Form dangnhap = new DangNhap();
            dangnhap.Show();
            @Session.maNV = "";
            @Session.quyen = "";
        }

        private void đổiMậtKhẩuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DoiMatKhau uc = new DoiMatKhau();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }


        private void thoátToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        
        private void hóaĐơnMuaHàngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HoaDonMuaHang uc = new HoaDonMuaHang();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void danhSáchPhiếuNhậpKhoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PhieuNhapKho_DS uc = new PhieuNhapKho_DS();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

        private void DSDDNCCtoolStripMenuItem1_Click(object sender, EventArgs e)
        {
            KhoBanHang.DonDatNCC uc = new KhoBanHang.DonDatNCC();
            uc.TopLevel = false;
            uc.Location = new Point(0, 0);
            uc.FormBorderStyle = FormBorderStyle.None;
            uc.Visible = true;
            panel1.Controls.Add(uc);
        }

       
       

        

       

      
       
    }
}
